﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpPickInterface.h"
#include "Vector3d.h"
#include "ElementId.h"
#include "Matrix4d.h"
#include "IObject.h"

namespace gcmp {

    class ICanvas;

    /// \brief 视图信息
    class GCMP_PICK_INTERFACE_EXPORT IViewerContext : public IObject
    {
        DEFINE_CAST_DERIVED(gcmp::IViewerContext, gcmp::IObject);
    public:
        /// \brief 产生默认的视图信息
        ///
        /// \return OwnerPtr<IViewerContext> 视图信息
        static OwnerPtr<IViewerContext> Create();
        virtual OwnerPtr<IViewerContext> Clone() const = 0;


        /// \brief 获取窗口的物理像素和与设备无关的像素之间的比率
        ///
        /// \return 窗口的物理像素和与设备无关的像素之间的比率
        virtual double GetDevicePixelRatio() const = 0;

        /// \brief 设置窗口的物理像素和与设备无关的像素之间的比率
        ///
        /// \param devicePixelRatio 窗口的物理像素和与设备无关的像素之间的比率
        /// \return void
        virtual void SetDevicePixelRatio(double devicePixelRatio) = 0;

        /// \brief 获得窗口高度
        ///
        /// \return int 窗口高度
        virtual int GetWindowHight()const = 0;

        /// \brief 设置窗口高度
        ///
        /// \param windowHight 窗口高度
        /// \return bool 成功返回true，失败返回false
        virtual bool SetWindowHight(int windowHight) = 0;

        /// \brief 获得窗口宽度
        ///
        /// \return int 窗口宽度
        virtual int GetWindowWidth()const = 0;

        /// \brief 设置窗口宽度
        ///
        /// \param windowWidth 窗口宽度
        /// \return bool 成功返回true，失败返回false
        virtual bool SetWindowWidth(int windowWidth) = 0;

        /// \brief 获得视图Id
        ///
        /// \return ElementId 视图Id
        virtual ElementId GetModelViewId()const = 0;

        /// \brief 设置视图Id
        ///
        /// \param modelViewId 视图Id
        /// \return bool 成功返回true，失败返回false
        virtual bool SetModelViewId(ElementId modelViewId) = 0;

        /// \brief 获得相机对应的视图矩阵
        ///
        /// 该矩阵为世界坐标系到相机坐标系的变换矩阵
        /// \return Matrix4d 视图Id
        virtual Matrix4d GetViewMatrix()const = 0;

        /// \brief 设置相机对应的视图矩阵
        ///
        /// 该矩阵为世界坐标系到相机坐标系的变换矩阵
        /// \param viewMatrix 视图矩阵
        /// \return bool 成功返回true，失败返回false
        virtual bool SetViewMatrix(Matrix4d viewMatrix) = 0;

        /// \brief 获得投影矩阵
        ///
        /// 该矩阵为相机坐标系上的坐标到屏幕坐标的变换矩阵
        /// \return Matrix4d 投影矩阵
        virtual Matrix4d GetProjectionMatrix()const = 0;

        /// \brief 设置投影矩阵
        ///
        /// 该矩阵为相机坐标系上的坐标到屏幕坐标的变换矩阵
        /// \param viewMatrix 投影矩阵
        /// \return bool 成功返回true，失败返回false
        virtual bool SetProjectionMatrix(Matrix4d val) = 0;

        /// \brief 获得相机方向
        ///
        /// \return Vector3d 相机方向
        virtual Vector3d GetCameraDirection()const = 0;

        /// \brief 设置相机方向
        ///
        /// \param cameraDirection 相机方向
        /// \return bool 成功返回true，失败返回false
        virtual bool SetCameraDirection(Vector3d cameraDirection) = 0;

        /// \brief 获得相机上方向
        ///
        /// \return Vector3d 相机上方向
        virtual Vector3d GetCameraUpDirection()const = 0;

        /// \brief 设置相机上方向
        ///
        /// \param cameraUpDirection 相机上方向
        /// \return bool 成功返回true，失败返回false
        virtual bool SetCameraUpDirection(Vector3d cameraUpDirection) = 0;

        /// \brief 设置画布
        ///
        /// \param pCanvas 画布指针
        /// \return void
        virtual void SetCanvas(const ICanvas *pCanvas) = 0;
    };

}// namespace gcmp

